# Maintainer: Sarah Ottinger <schalaalexiazeal@gmail.com>

_realname=soundfile
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=0.10.3.post1
pkgrel=1
pkgdesc='An audio library based on libsndfile, CFFI and NumPy (mingw-w64)'
arch=('any')
url="https://github.com/bastibe/SoundFile"
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-python-cffi" "${MINGW_PACKAGE_PREFIX}-python-numpy" "${MINGW_PACKAGE_PREFIX}-libsndfile")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
source=("https://files.pythonhosted.org/packages/source/S/SoundFile/SoundFile-${pkgver}.tar.gz")
sha256sums=('490cff42650733d1832728b937fe99fa1802896f5ef4d61bcf78cf7ebecb107b')

prepare() {  
  cd "$srcdir"
  rm -rf python-build-${CARCH} | true
  cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}

build() {
  msg "Python build for ${CARCH}"  
  cd "${srcdir}/python-build-${CARCH}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

package() {
  cd "${srcdir}/python-build-${CARCH}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
    --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
